package lesson5.example5;

import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import lesson5.example3.transformer.ReplaceTransformer;
import lesson5.example3.transformer.ResetTransformer;

@RestController
public class Controller {
	
	@RequestMapping("/replace")
	public void replace() throws Exception{
		ReplaceTransformer rlc = new ReplaceTransformer(
    			"lesson5.example5.Controller",
    			"list",
    			50, 
    			"{ System.out.println(\"进入方法...\"); }"
            );
    	
        ByteBuddyUtil.transformer(rlc,Class.forName("lesson5.example5.Controller"));
	}
    
	@RequestMapping("/reset")
	public void reset() throws Exception{
		 ByteBuddyUtil.transformer(
                 new ResetTransformer(),
                 Class.forName("lesson5.example5.Controller"));
    	
	}
    
	@RequestMapping("/test")
    public String list(){
        return "OK";
    }
    
}


